{% extends "base.html" %}

{% block content %}
    <h1>用户列表</h1>
    <a href="{{ url_for('add_user') }}" class="btn btn-primary mb-3">添加用户</a>
    
    <table class="table table-striped">
        <thead>
            <tr>
                <th>ID</th>
                <th>用户名</th>
                <th>邮箱</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for user in users %}
            <tr>
                <td>{{ user.id }}</td>
                <td>{{ user.username }}</td>
                <td>{{ user.email }}</td>
                <td>
                    <a href="{{ url_for('edit_user', user_id=user.id) }}" class="btn btn-sm btn-warning">编辑</a>
                    <a href="{{ url_for('delete_user', user_id=user.id) }}" class="btn btn-sm btn-danger" onclick="return confirm('确定删除吗?')">删除</a>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
{% endblock %}